package com.zxgllhh.generator.tydic;

import java.io.File;
import java.util.List;

import org.apache.commons.io.FileUtils;

import com.zxgllhh.domain.ConnectionContext;
import com.zxgllhh.domain.Table;

/**
 * 
 * @author Zhao,XingGuo
 * @version 2010-01-21 生成器的大管家
 *
 */
public class GenaratorManager {

	public static void go(List<Table> tableList) throws Exception {
		
		//init
		String databaseName = ConnectionContext.getConnection().getMetaData().getDatabaseProductName();
		
		File file = new File("E://generatorCode");
		FileUtils.deleteDirectory(file);
		
		for(Table table : tableList){
			ActionGenarator.go(table);
			DomainGenarator.go(table);
			DaoGenarator.go(table);
			DaoImplGenarator.go(table);
			MapsGenarator.go(table,databaseName);
			ServiceGenarator.go(table);
			ServiceImplGenarator.go(table);
			ListGenarator.go(table);
			FormGenarator.go(table);
			ViewGenarator.go(table);
		}
		FacadeGenarator.go(tableList);
		FacadeImplGenarator.go(tableList);
		SqlMapConfigGenarator.go(tableList);
	}

}
